﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ContraGlobal
{
    public struct ContraLevel
    {
        public string SceneName;
        public string LevelName;
    }
    public struct ContraPlayer
    {
        public int Life;
        public int Score;
    }

    public static string SceneName_Title = "Contra-标题";
    public static string SceneName_Map = "Contra-全关地图";
    public static string SceneName_GameOver = "Contra-GameOver";
    public static int currentLevel = 0;
    public static ContraLevel[] SceneName_Level = new ContraLevel[]
    {
        new(){SceneName="Contra-第1关",LevelName="JUNGLE", },
        new(){SceneName="Contra-第2关",LevelName="BASE1", },
        new(){SceneName="Contra-第3关",LevelName="WATERFALL" },
        new(){SceneName="Contra-第4关",LevelName="BASE2" },
        new(){SceneName="Contra-第5关",LevelName="SNOW FIELD" },
        new(){SceneName="Contra-第6关",LevelName="ENERGY ZONE" },
        new(){SceneName="Contra-第7关",LevelName="HANGAR" },
        new(){SceneName="Contra-第8关",LevelName="ALIEN'S LAIR" },
    };

    private static bool twoPlayers = false;
    public static bool IsTwoPlayers()
    {
        return twoPlayers;
    }
    public static void SetTwoPlayers(bool v)
    {
        twoPlayers = v;
    }
    public static int HIScroe = 20000;
    public static ContraPlayer Player1 = new() { Score = 0, Life = 30 };
    public static ContraPlayer Player2 = new() { Score = 0, Life = 3 };
    public static int OriginalLife = 3;
    public static void ResetLife()
    {
        Player1.Life = Player2.Life = OriginalLife;
    }

    public static ContraLevel CurrentLevel()
    {
        int index = currentLevel;
        if (index >= 0 && index < SceneName_Level.Length)
        {
            return SceneName_Level[index];
        }
        else
        {
            return new ContraLevel() { SceneName = null, LevelName = null };
        }
    }
    public static ContraLevel NextLevel()
    {
        currentLevel += 1;
        return CurrentLevel();
    }

}
